void main() {
  // 示例二
  try {} on OutOfMemoryError {
    // 一个特殊的异常
  } on Exception catch (e) {
    // 其他任何异常
  } catch (e) {
    // 没有指定的类型，处理所有异常
  }

  // 示例三
  try {
    // ···
  } on Exception catch (e) {
    print('Exception details:\n $e');
  } catch (e, s) {
    print('Exception details:\n $e');
    print('Stack trace:\n $s');

    //示例四
    try {
      misbehave();
    } catch (e) {
      print('main() finished handling ${e.runtimeType}.');
    }
  }
}

//示例四
void misbehave() {
  try {
    dynamic foo = true;
    print(foo++); // Runtime error
  } catch (e) {
    print('misbehave() partially handled ${e.runtimeType}.');
    rethrow; // Allow callers to see the exception.
  }
}
